Skip to content

feat: add support for alerts #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2023
Merged

feat: add support for alerts #67

merged 1 commit into from
Apr 26, 2023

Conversation

Salakar
Copy link
Member

@Salakar Salakar commented Apr 26, 2023

Testing

Deployed one of each function type to ensure they deploy correctly:

from firebase_functions import alerts_fn
from firebase_functions.alerts import app_distribution_fn
from firebase_functions.alerts import billing_fn
from firebase_functions.alerts import crashlytics_fn
from firebase_functions.alerts import performance_fn


@alerts_fn.on_alert_published(alert_type=alerts_fn.AlertType.BILLING_PLAN_UPDATE
                             )
def onalertpublished(
    alert: alerts_fn.AlertEvent[alerts_fn.FirebaseAlertData[
        billing_fn.PlanUpdatePayload]]
) -> None:
    print(alert)


@app_distribution_fn.on_in_app_feedback_published()
def appdistributioninappfeedback(
        alert: app_distribution_fn.InAppFeedbackEvent) -> None:
    print(alert)


@app_distribution_fn.on_new_tester_ios_device_published()
def appdistributionnewrelease(
        alert: app_distribution_fn.NewTesterDeviceEvent) -> None:
    print(alert)


@billing_fn.on_plan_automated_update_published()
def billingautomatedplanupdate(
        alert: billing_fn.BillingPlanAutomatedUpdateEvent) -> None:
    print(alert)


@billing_fn.on_plan_update_published()
def billingplanupdate(alert: billing_fn.BillingPlanUpdateEvent) -> None:
    print(alert)


@crashlytics_fn.on_new_fatal_issue_published()
def crashlyticsnewfatalissue(
        alert: crashlytics_fn.CrashlyticsNewFatalIssueEvent) -> None:
    print(alert)


@crashlytics_fn.on_new_nonfatal_issue_published()
def crashlyticsnewnonfatalissue(
        alert: crashlytics_fn.CrashlyticsNewNonfatalIssueEvent) -> None:
    print(alert)


@crashlytics_fn.on_new_anr_issue_published()
def crashlyticsnewanrissue(
        alert: crashlytics_fn.CrashlyticsNewAnrIssueEvent) -> None:
    print(alert)


@crashlytics_fn.on_regression_alert_published()
def crashlyticsregression(
        alert: crashlytics_fn.CrashlyticsRegressionAlertEvent) -> None:
    print(alert)


@crashlytics_fn.on_stability_digest_published()
def crashlyticsstabilitydigest(
        alert: crashlytics_fn.CrashlyticsStabilityDigestEvent) -> None:
    print(alert)


@crashlytics_fn.on_velocity_alert_published()
def crashlyticsvelocity(
        alert: crashlytics_fn.CrashlyticsVelocityAlertEvent) -> None:
    print(alert)


@performance_fn.on_threshold_alert_published()
def performancethreshold(
        alert: performance_fn.PerformanceThresholdAlertEvent) -> None:
    print(alert)

All functions deployed without issue:

image

Firebase console shows the correct fn types for each:
image

Billing plan update fn triggers with correct payload when upgrading/downgrading a Firebase project:

image

@Salakar Salakar force-pushed the alerts branch 2 times, most recently from d98bf02 to 0080ecb Compare April 26, 2023 03:02
@taeold taeold merged commit 842257b into firebase:main Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants